package qmsz.api.service.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import qmsz.api.dao.QMChargeOrderDAO;
import qmsz.api.domain.QMChargeOrder;
import qmsz.api.service.QMChargeOrderService;

@Service
public class QMChargeOrderServiceImpl implements QMChargeOrderService {
	
	private static final Logger logger = Logger.getLogger(QMChargeOrderServiceImpl.class);

	@Autowired
	QMChargeOrderDAO qmchargeorderDAO;
	
	@Override
	public QMChargeOrder findChargeOrderByOrderNum(String orderNum) {
		QMChargeOrder value = null;
		try {
			value = qmchargeorderDAO.findChargeOrderByOrderNum(orderNum);
		} catch (Exception e) {
			logger.error("query error", e);
			value = null;
		}
		return value;
	}
	
	@Override
	public QMChargeOrder getAccountAndOrderNumByCardNum(String cardNum) {
		QMChargeOrder value = null;
		try {
			value = qmchargeorderDAO.getAccountAndOrderNumByCardNum(cardNum);
		} catch (Exception e) {
			logger.error("query error", e);
			value = null;
		}
		return value;
	}
	
	@Override
	public String getChargeOrderIDByOrderNum(String orderNum) {
		String id = null;
		try {
			id = qmchargeorderDAO.getChargeOrderIDByOrderNum(orderNum);
		} catch (Exception e) {
			logger.error("query error", e);
			id = null;
		}
		return id;
	}

}
